package com.sunwayworld.basemodule.business.folder.resource.impl;

import com.sunwayworld.basemodule.business.folder.resource.LimsFolderResource;
import com.sunwayworld.basemodule.business.folder.service.LimsFolderService;
import com.sunwayworld.basemodule.business.folder.validators.LimsQCSampleDeleteValidator;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.validator.data.annotation.ValidateDataWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@LogModule("样本项目执行单")
@RestController
@GikamBean
public class LimsFolderResourceImpl implements LimsFolderResource {

    @Autowired
    private LimsFolderService limsFolderService;

    @Override
    public LimsFolderService getService() {
        return limsFolderService;
    }

    @Log(value = "新增样本项目执行单", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Log(value = "添加质控样本", type = LogType.INSERT)
    @Override
    public void addQcSample(RestJsonWrapperBean jsonWrapperBean) {
        getService().addQcSample(jsonWrapperBean);
    }

    @Log(value = "移除质控样本", type = LogType.DELETE)
    @ValidateDataWith(LimsQCSampleDeleteValidator.class)
    @Override
    public void deleteQcSample(RestJsonWrapperBean jsonWrapperBean) {
        getService().deleteQcSample(jsonWrapperBean);
    }
}
